Global Functions 

See subtopics: escape(), eval(), isFinite(), isNaN(), parseFloat(), parseInt(), ScriptEngine(), ScriptEngineBuildVersion(), ScriptEngineMajorVersion(), ScriptEngineMinorVersion(), toString(), unescape(), unwatch(), and watch().

escape()NN 2   IE J1   ECMA 1

Returns a URL-encoded version of the string passed as a parameter to the function. URL encoding converts non-alphanumeric characters to hexadecimal values (such as %20 for the space character). URL-encoded strings do not normally encode the plus symbol because those symbols are used to separate components of search strings. If you must have the plus symbol encoded as well, Navigator 4 offers a second parameter (a numeral 1) to turn on that switch for the method.

 
Returned Value
A string.
 
Parameters
string Any string value.
eval()NN 2   IE J1   ECMA 1

Returns an object reference of the object described as a string in the parameter of the function. For example, if a form has a sequence of text fields named entry1, entry2, entry3, and so on, you can still use a for loop to cycle through all items by name if you let the eval() function convert the string representation of the names to object references:

for (var i = 1; i <=5; i++) { oneField = eval("document.forms[0].entry" + i) oneValue = oneField.value ... }
 
Returned Value
Object reference.
 
Parameters
string Any string representation of an object reference.
isFinite()NN 4   IE J3   ECMA 1

Returns a Boolean value of true if the number passed as a parameter is anything within the range of Number.MIN_VALUE and Number.MAX_VALUE, inclusive. String values passed as parameters cause the function to return false.

 
Returned Value
Boolean.
 
Parameters
expression Any JavaScript expression.
isNaN()NN 2   IE J1   ECMA 1

Returns a Boolean value of true if the expression passed as a parameter does not evaluate to a numeric value.

 
Returned Value
Boolean.
 
Parameters
expression Any JavaScript expression.
parseInt()NN 2   IE J1   ECMA 1

Returns an integer value (as a number data type in base-10) of the numerals in the string passed as a parameter. The string value must at least begin with a numeral, or the result is NaN. If the string starts with numbers but changes to letters along the way, only the leading numbers are converted to the integer. Therefore, you can use the expression:

parseInt(navigator.appVersion)

to extract only the whole number of the version that leads the otherwise long string that is returned from that property.

The optional radix parameter lets you specify the base of the number being passed to the function. A number string that begins with zero is normally treated as an octal number, which gives you the wrong answer. It is a good idea to use the radix value of 10 on all parseInt() functions if all of your dealings are in base-10 numbers.

 
Returned Value
Integer of base-10.
 
Parameters
string Any string that begins with one or more numerals.
radix An integer of the number base of the number passed as the string parameter (e.g., 2, 10, 16).
parseFloat()NN 2   IE J1   ECMA 1

Returns a number value (either an integer or floating-point number) of the numerals in the string passed as a parameter. The string value must at least begin with a numeral, or the result is NaN. If the string starts with numbers but changes to letters along the way, only the leading numbers are converted to the integer. Therefore, you can use the expression:

parseFloat(navigator.appVersion)

to extract the complete version number (e.g., 4.03) that leads the otherwise long string that is returned from that property.

If the converted value does not have any nonzero values to the right of the decimal, the returned value is an integer. Floating-point values are returned only when the number calls for it.

 
Returned Value
Number.
 
Parameters
string Any string that begins with one or more numerals.
ScriptEngine(), ScriptEngineBuildVersion(), ScriptEngineMajorVersion(), ScriptEngineMinorVersion()NN n/a   IE J2   ECMA n/a

These Internet Explorer-only functions reveal information about the scripting engine (JScript, VBScript, or VBA) currently in force (executing the statement invoking the function) and which version of that engine is installed. For JScript, the version refers to the version of the Jscript.dll file installed among the browser's support files. The major version is the part of the version number to the left of the version decimal point; the minor version is the part to the right of the decimal point. More granular than that is the internal build number that Microsoft uses to keep track of release generations during development and through release.

 
Returned Value
ScriptEngine() returns a string of one of the following engine names: JScript | VBA | VBScript. All other functions return integer values.
 
Parameters
None.
toString()NN 3   IE J3   ECMA n/a

Returns a string version of a number in the number base specified by the radix parameter. This variant of the toString() function lets you perform number base conversions. For example, the following sequence converts a base-10 number to a base-16 version as a string:

var a = 32 var b = a.toString(16)

After these statements execute, the value of b is "20".

 
Returned Value
A string.
 
Parameters
radix An integer of the number base of the result (e.g., 2, 10, 16).
unescape()NN 2   IE J1   ECMA 1

Returns a decoded version of the URL-encoded string passed as a parameter to the function. URL encoding converts nonalphanumeric characters to hexadecimal values (such as %20 for the space character).

 
Returned Value
String.
 
Parameters
string Any URL-encoded string value.
unwatch(), watch()NN 4   IE n/a   ECMA n/a

These Navigator-specific functions are used primarily by JavaScript debuggers. When a statement invokes the watch() function for an object, the parameters include the property whose value is to be watched and the reference to the function to be invoked whenever the value of the property is changed by an assignment statement. To turn off the watch operation, invoke the unwatch() function for the particular property engaged earlier.

 
Returned Value
Nothing.
 
Parameters
property The name of the object's property to be watched.
funcHandler The name of the function (no parentheses) to be invoked whenever the watched property's value changes.